//
//  GQConcernAndFansCell.m
//  GuQu
//
//  Created by HELIUM STAR on 15/5/27.
//  Copyright (c) 2015年 HELIUM STAR. All rights reserved.
//

#import "GQConcernAndFansCell.h"

@implementation GQConcernAndFansCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self setUpChildView];
    }
    return self;
}

- (void)setUpChildView
{
    CGFloat height = 58;
    CGFloat margin = 10;
    CGFloat imageWidth = 40;
    CGFloat btnWidth = 55;
    CGFloat btnHeight = 25;
    //创建UIImageView
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithRoundName:@"icon"]];
    imageView.x = margin;
    imageView.y = (height - imageWidth) / 2;
    imageView.width = imageWidth;
    imageView.height = imageWidth;
    
    UIImageView *vertify = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"relationship_famous_accreditation"]];
    vertify.width = 15;
    vertify.height = 15;
    vertify.x = imageView.width - vertify.width;
    vertify.y = vertify.x;
    [imageView addSubview:vertify];
    
    [self addSubview:imageView];
    
    //创建title
    UILabel *title = [[UILabel alloc] init];
    title.x = CGRectGetMaxY(imageView.frame) + 10;
    title.y = margin;
    title.width = 100;
    title.height = 20;
    title.text = @"百里放羊";
    title.font = [UIFont systemFontOfSize:16];
    title.textColor = [UIColor blackColor];
    [self addSubview:title];
    
    //创建详细介绍
    UILabel *subTitle = [[UILabel alloc] init];
    subTitle.x = title.x;
    subTitle.y = CGRectGetMaxY(title.frame);
    subTitle.width = 150;
    subTitle.height = 20;
    subTitle.text = @"中国书画协会名誉会长";
    subTitle.font = [UIFont systemFontOfSize:12];
    subTitle.textColor = [UIColor lightGrayColor];
    [self addSubview:subTitle];
    
    //关注状态
    UIButton *btn = [[UIButton alloc] init];
    btn.x = self.width - btnWidth - margin;
    btn.y = (height - btnHeight) / 2;
    btn.width = btnWidth;
    btn.height = btnHeight;
    [btn setImage:[UIImage imageNamed:@"relationship_concern"] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:@"relationship_friend"] forState:UIControlStateSelected];
    [btn addTarget:self action:@selector(btnDidClick:) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:btn];
    
}

- (void)btnDidClick:(UIButton *)btn
{
    btn.selected = !btn.selected;
}

@end
